﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WordGame.Question;

namespace WordGame.Answer
{
    class Sofia:IWordGame
    {
        public int getCheater(string[] first, string[] second, string[] third)
        {
            //throw new NotImplementedException();
            int l1 = first.Length;
            int l2 = second.Length;
            int l3 = third.Length;
            //if (l1 > 50 || l2 > 50 || l3 > 50) return -1;
            if (first[0]=="" && l2 == 1 && l3 == 0) return -1;

            try
            {
                for (int i = 0; i < Math.Max(l1, Math.Max(l2, l3)); i++)
                {
                    if ((i >= 1 & first[i] != null) && (!first[i].Contains(third[i - 1]) || (first[i].Length != third[i - 1].Length + 1)))
                    {
                        return 3;
                    }

                    if ((second[i] != null) && (!second[i].Contains(first[i]) || (second[i].Length != first[i].Length + 1)))
                    {
                        return 1;
                    }

                    if ((third[i] != null) && (!third[i].Contains(second[i]) || (third[i].Length != second[i].Length + 1)))
                    {
                        return 2;
                    }

                }
            }
            catch
            {

            }
                return -1;


            
        }
    }
}
